import { IComponentDirective } from "../Interfaces/IMVVM";
import ADQ from "../Core/ADQ";

/**
 *VM 静态工厂类
 */
export class VMFactory {
  static rendering: any;
  static componentDirective: any;
  private static gloableId: number = 0;
  /**
   * 获取渲染工具类
   */
  static getRenderUtil(): any {
    if (!VMFactory.rendering) {
      VMFactory.rendering = ADQ.getResolve("IRendering");
    }
    return VMFactory.rendering;
  }
  /**获取全局VM自增标识 */
  static getGloableId(): number {
    return ++this.gloableId;
  }
  /**
   * 获取组件判断接口
   */
  static getDirective(): IComponentDirective {
    if (!VMFactory.componentDirective) {
      VMFactory.componentDirective = ADQ.getResolve("IComponentDirective");
    }
    return VMFactory.componentDirective;
  }
}
